<template>
    <!-- 组件的结构 -->
    <div class="demo1">
        <h2>游戏名称{{Gamename}}</h2>
        <h2>游戏城市{{city}}</h2>
        <button @click="showName">点击</button>
    </div>
</template>

<script>
    //组件交互相关的代码
    export default{
        name:'Game',
        data(){
            return{
            Gamename:'光与夜之恋',
            city:'光启市',
            }
        },
        methods: {
            showName(){
            alert(this.Gamename)
            }
        },
    }
        
</script>

<style>
    /* 组件的样式 */
    .demo1{
        background-color: palevioletred;
    }
</style>